package com.nbsaas.boot.customer.data.entity;

import com.nbsaas.boot.code.annotation.FormAnnotation;
import com.nbsaas.boot.code.annotation.FormField;
import com.nbsaas.boot.code.annotation.InputType;
import com.nbsaas.boot.code.annotation.SearchItem;
import com.nbsaas.boot.jpa.data.entity.LongEntity;
import com.nbsaas.boot.rest.filter.Operator;
import lombok.Data;
import org.hibernate.annotations.Comment;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.math.BigDecimal;

@FormAnnotation( model = "客户等级")
@Data
@Entity
@Table(name = "bs_shop_user_level")
public class CustomerLevel extends LongEntity {

    @SearchItem(name = "name", label = "等级名称")
    @FormField(title = "等级名称", grid = true, required = true)
    @Comment("等级名称")
    @Column(length = 30)
    private String name;


    @Comment("排序号")
    private Integer sort_num;


    @FormField(title = "折扣", grid = true)
    @Comment("折扣")
    private BigDecimal discount;

    @Comment("购买价格")
    private BigDecimal money;

    @Comment("图标地址")
    @FormField(title = "图标", grid = true, type = InputType.image)
    private String icon;

    @Comment("背景图片地址")
    @Column(length = 300)
    @FormField(title = "背景", grid = true, type = InputType.image)
    private String background;


    @FormField(title = "备注", type = InputType.textarea)
    private String note;


    @SearchItem(name = "shop", label = "来源店铺", operator = Operator.eq, classType = Long.class, show = false)
    @Comment("来源店铺")
    private Long shop;
}
